package com.hy.hongying.controller;

import com.hy.hongying.config.SystemConfig;
import com.hy.hongying.service.intf.OssService;
import com.hy.hongying.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;

@CrossOrigin
@RestController
@Api(tags = "各种文件上传")
@RequestMapping("/hy/ossController/")
public class OssController {
    @Autowired
    private OssService service;
    @ApiOperation("视频上传接口")
    @PostMapping("uploadVideo.do")
    public R uploadVideo(HttpServletRequest request, MultipartFile file){
        return service.insertOss(file,request.getHeader(SystemConfig.USER_TOKEN),SystemConfig.OSS_TYPE_1);
    }

}
